package com.itheima.网络编程.tcp编程.tcp编程.文件上传线程池二;

import java.io.*;
import java.net.Socket;
import java.util.Scanner;

public class 客户端 {
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(System.in);
        Socket sk=new Socket("127.0.0.1",10011);
        System.out.println("请输入你要上传的文件路径名:");
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(sk.getOutputStream()));
        String strx="day16网络编程\\subways.txt";
        //strx1:    C:\Users\身体和心灵\Desktop\图片\subways.txt
        String strx1=sc.next();
//        BufferedReader br=new BufferedReader(new FileReader(strx));
        BufferedReader br=new BufferedReader(new FileReader(strx1));
        String str;
        while ((str=br.readLine())!=null){
            bw.write(str);
            bw.newLine();
            bw.flush();
        }
        sk.shutdownOutput();
        System.out.println("=====================");
        BufferedReader brServer=new BufferedReader(new
                InputStreamReader(sk.getInputStream()));
        String str1;
        while ((str1=brServer.readLine())!=null){
            System.out.println(str1);
        }
        br.close();
        bw.close();
        brServer.close();
        sk.close();

    }
}
